<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../css/auislide.css" />
    <link rel="stylesheet" type="text/css" href="../css/play.css" />
    <style type="text/css">
        html,
        body {
            background-color: #efefef;
        }

        .aui-tabBar-fixed {
            position: fixed;
            bottom: 0;
            left: 0;
            z-index: 49;
        }

        .aui-class-list-title {
            padding: 5px 15px;
            background: #f2efee;
            width: 100%;
            position: relative;
            font-size: 0.7rem;
        }

        .aui-class-list-item {
            display: flex;
            -webkit-box-align: center;
            align-items: center;
            width: 30%;
            float: left;
            position: relative;
            z-index: 0;
            height: 60px;
            margin-left: 3%;
        }

        .aui-class-list-box {
            background: #fff;
            overflow: hidden;
        }

        .aui-cell-fl img {
            width: 25px;
            margin-right: 15px;
            display: block;
            border: none;
            border-radius: 3rem;
        }

        .aui-cell-fr {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
            color: #fff;
            font-size: 0.6rem;
        }

        .wz {
            margin: 0 auto;
            width: 96%;
            font-size: 10px;
            background-color: #ffeb3c;
            border-radius: 0.1rem;
            height: 20px;
            margin-top: 10px;
            text-align: center;
            color: #4e4e4c;
        }

        .play {
            margin-top: 90%;
        }
    </style>
</head>

<body style="background-image:  url(../image/sy.png);background-repeat: no-repeat;background-size: 120px 40px;background-position: 50% 100%;">
    <header class="aui-navBar aui-navBar-fixed" style="background: #1b7eff;position: relative;padding-top:25px;" id="header">
        <a tapmode onclick="closeWin()" class="aui-navBar-item" tyle="color: #c4c4c4;">
            <i style="position: absolute;width: 12px;height: 12px;border: solid #fff;border-width: 1px 0 0 1px;transform: rotate(-45deg)!important;"></i>
        </a>
        <div class="aui-center">
            <span class="aui-center-title" id="title" style="color: #fff;">  正在播放 </span>
            <img src="../image/d_02.png" style="width:25px;float:right;" onclick="TpPlay()">
        </div>
    </header>
    <div class="play">
        <img src="../image/d_04.png" style="width: 50px;height: 20px;position: absolute;float:  right;right: 10%;margin-top: -10px;">
        <a onclick="Fx()" class="aui-class-list-item">
            <div class="aui-cell-fl">
                <img src="../image/d_01.png" alt="">
            </div>
            <div class="aui-cell-fr">分享推荐</div>
        </a>
        <a onclick="Tp()" class="aui-class-list-item">
            <div class="aui-cell-fl">
                <img src="../image/d_02.png" alt="">
            </div>
            <div class="aui-cell-fr">投屏帮助</div>
        </a>
        <a id="play" onclick="huanxian()" class="aui-class-list-item">
            <div class="aui-cell-fl">
                <img src="../image/d_03.png" alt="">
            </div>
            <div class="aui-cell-fr">更换线路</div>
        </a>
    </div>
    <div class="wz">影片中出现的文字广告请勿相信，谨防上当受骗！</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/date.min.js"></script>
<script type="text/javascript">
    var jx_url2 = localStorage.getItem('play_url2');
    apiready = function() {
            api.parseTapmode();
            var header = $api.byId('aui-header');
            $api.fixStatusBar(header);
            var headerPos = $api.offset(header);
            var body_h = $api.offset($api.dom('body')).h;

            api.addEventListener({
                name: 'keyback'
            }, function(ret, err) {
                api.setScreenOrientation({
                    orientation: 'portrait_up'
                });
                api.closeWin();
            });

            var browser = api.require('webBrowser');
            browser.openView({
                url: api.pageParam.url,
                rect: {
                    x: 0,
                    y: 70,
                    w: 'auto',
                    h: 300,
                }
            }, function(ret, err) {
                switch (ret.state) {
                    case 0:
                        break;
                    case 1:
                        break;
                    case 2:
                        break;
                    case 3:
                        break;
                    case 4:
                        break;
                    default:
                        break;
                };
            });
            if (api.pageParam.needRecordHistory) {
                record_play_history();
            }
        }
        //保存播放历史记录
    function record_play_history() {
        api.ajax({
            url: 'http://hjhkjk.xyz/login/login/jilu?uid=3',
            data: {
                values: {
                    uid: localStorage.getItem('user_id'),
                    title: api.pageParam.title,
                    url: api.pageParam.srcUrl,
                    time: new Date().format('yyyy-MM-dd hh:mm:ss'),
                    ping: getPing(api.pageParam.srcUrl)
                }
            }
        }, function(ret, err) {});
    }
    //记录播放平台
    function getPing(url) {
        if (url.indexOf("youku.com") > 0) {
            return '优酷';
        } else if (url.indexOf("iqiyi.com") > 0) {
            return '爱奇艺';
        } else if (url.indexOf("v.qq.com") > 0) {
            return "腾讯"
        } else if (url.indexOf("tv.sohu.com") > 0) {
            return "搜狐"
        } else if (url.indexOf("v.qq.com") > 0) {
            return "pptv"
        } else if (url.indexOf("pptv.com") > 0) {
            return "芒果"
        } else if (url.indexOf("mgtv.com") > 0) {
            return "M1905"
        } else if (url.indexOf("1905.com") > 0) {
            return "暴风"
        } else if (url.indexOf("baofeng.com") > 0) {
            return "乐视"
        } else if (url.indexOf("le.com") > 0) {
            return "风行"
        } else if (url.indexOf("xxooweizhiurl.com") > 0) {
            return "未知"
        }
    }

    //获取字幕
    // function getCaption(obj){
    //   var index=obj.lastIndexOf("\=");
    //   obj=obj.substring(index+1,obj.length);
    //   return obj;
    // }

    //关闭播放窗口
    function closeWin() {
        api.setScreenOrientation({
            orientation: 'portrait_up'
        });
        api.closeWin();
    }

    function huanxian() {
        var jiekou = "";
        api.actionSheet({
            title: '影视VIP线路',
            cancelTitle: '取消',
            buttons: ['VIP线路1', 'VIP线路2', 'VIP线路3', 'VIP线路4', 'VIP线路5', 'VIP线路6']
        }, function(ret, err) {
            var index = ret.buttonIndex;
            if (ret.buttonIndex == 1) {
                jiekou = localStorage.getItem('play_url1');
            }
            if (ret.buttonIndex == 2) {
                jiekou = localStorage.getItem('play_url2');
            }
            if (ret.buttonIndex == 3) {
                jiekou = localStorage.getItem('play_url3');
            }
            if (ret.buttonIndex == 4) {
                jiekou = localStorage.getItem('play_url4');
            }
            if (ret.buttonIndex == 5) {
                jiekou = localStorage.getItem('play_url5');
            }
            if (ret.buttonIndex == 6) {
                jiekou = localStorage.getItem('play_url6');
            }
            if (ret.buttonIndex == 7) {
                jiekou = localStorage.getItem('play_url7');
            }
            api.hideProgress();
            var browser = api.require('webBrowser');
            browser.loadUrl({
                url: jiekou + api.pageParam.srcUrl
            });
        });
    }

    //分享推荐
    function Fx() {
        api.openWin({
            name: 'share_win',
            url: 'share_win.html',
        });
    }

    //投屏帮助 /////
    function Tp() {
        api.openWin({
            name: 'daili_guanli_win',
            url: './tp_win.html',
            delay: 100,
            pageParam: {
                url: 'http://hjhkjk.xyz/tp/tp.png'
            },
            bgColor: 'rgba(0,0,0,0)'
        });
    }

    function TpPlay() {
        var LBAirDrop = api.require('LBAirDrop');
        LBAirDrop.searchList(function(ret) {
            alert(JSON.stringify(ret));
        });
    }
</script>

</html>
